import http from '../utils/http'

export function loginReq(adminname: string, password: string) {
  // 返回promise对象，这个对象获取http请求的结果
  return http({
    url: 'admin/login',
    method: 'post',
    data: { adminname, password }
  })
}
export function adminListReq() {
  return http.request({
    url: 'admin/list',
    method: 'get'
  })
}
export function DeleteUserReq(adminid: string) {
  return http.request({
    url: 'admin/delete',
    method: 'post',
    data: {
      adminid
    }
  })
}
interface From {
  adminname: string
  password: string
  role: number
  checkedKeys: string
}
export function UserRegisterReq(item: From) {
  return http.request({
    url: 'admin/add',
    method: 'post',
    data: item
  })
}

export function FindManagerReq(adminname: string) {
  return http.request({
    url: 'admin/detail',
    method: 'get',
    params: {
      adminname
    }
  })
}
